package org.gap.web.jsf;

import java.util.List;

import org.gap.dao.PersistentLoginsDAO;

import org.gap.domain.PersistentLogins;

import org.gap.service.PersistentLoginsService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Component;

import org.springframework.transaction.annotation.Transactional;

/**
 * Spring Component that handles CRUD requests for PersistentLogins entities
 * 
 */
@Scope("session")
@Component("PersistentLoginsComponent")
public class PersistentLoginsComponentImpl implements PersistentLoginsComponent {

	/**
	 * Data type variable that provides CRUD operations for PersistentLogins entities
	 * 
	 */
	private PersistentLogins persistentlogins;

	/**
	 * DAO injected by Spring that manages PersistentLogins entities
	 * 
	 */
	@Autowired
	private PersistentLoginsDAO persistentLoginsDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for PersistentLogins entities
	 * 
	 */
	@Autowired
	private PersistentLoginsService persistentLoginsService;

	/** 
	 */
	public PersistentLoginsComponentImpl() {
	}

	/**
	 * Show all PersistentLogins entities
	 * 
	 */
	@Transactional
	public List<PersistentLogins> listPersistentLoginss() {
		return new java.util.ArrayList<PersistentLogins>(persistentLoginsService.loadPersistentLoginss());
	}

	/**
	 * Getter for variable PersistentLogins
	 * 
	 */
	@Transactional
	public PersistentLogins getPersistentlogins() {
		return persistentlogins;
	}

	/**
	 * Select an existing PersistentLogins entity
	 * 
	 */
	@Transactional
	public String selectPersistentLogins(String seriesKey) {
		persistentlogins = persistentLoginsDAO.findPersistentLoginsByPrimaryKey(seriesKey);

		return "/jsf/persistentlogins/viewPersistentLogins.xhtml";
	}

	/**
	 * Delete an existing PersistentLogins entity
	 * 
	 */
	@Transactional
	public String deletePersistentLogins(String seriesKey) {
		PersistentLogins persistentlogins = persistentLoginsDAO.findPersistentLoginsByPrimaryKey(seriesKey);
		persistentLoginsService.deletePersistentLogins(persistentlogins);
		return "/jsf/persistentlogins/listPersistentLoginss.xhtml";
	}

	/**
	 * Save an existing PersistentLogins entity
	 * 
	 */
	@Transactional
	public String savePersistentLogins(PersistentLogins persistentlogins) {
		persistentLoginsService.savePersistentLogins(persistentlogins);
		return "/jsf/persistentlogins/listPersistentLoginss.xhtml";
	}

	/**
	 * Select the PersistentLogins entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeletePersistentLogins(String seriesKey) {
		persistentlogins = persistentLoginsDAO.findPersistentLoginsByPrimaryKey(seriesKey);

		return "/jsf/persistentlogins/deletePersistentLogins.xhtml";
	}

	/**
	 * Create a new PersistentLogins entity
	 * 
	 */
	@Transactional
	public String newPersistentLogins() {
		persistentlogins = new PersistentLogins();

		return "/jsf/persistentlogins/createPersistentLogins.xhtml";
	}

	/**
	 * Edit an existing PersistentLogins entity
	 * 
	 */
	@Transactional
	public String editPersistentLogins(String seriesKey) {
		persistentlogins = persistentLoginsDAO.findPersistentLoginsByPrimaryKey(seriesKey);

		return "/jsf/persistentlogins/editPersistentLogins.xhtml";
	}

}
